<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:t="http://myfaces.apache.org/tomahawk"
      xmlns:p="http://primefaces.prime.com.tr/ui">

<ui:composition template="/jsp/include/template.xhtml">

	<ui:define name="sessionInfo">
		<h:form id="headerForm">
		
		<script language="javascript">
		    function changeTrial(){
		        document.getElementById("headerForm:hiddenButton").click();
		    }
		</script>
		
		<table style="width: 100%; float: right; vertical-align: top;">
			<tr>
				<td>
					<table>
						<tr>
							<td style="vertical-align: top; text-align: right;">
								<b><h:outputText value="#{(!empty sessionInv.trial) ? msgs['jsf.generic.Trial'] : ''}" /></b>
							</td>
							<td style="vertical-align: top">
								<h:selectOneMenu 
									id="trialSel" 
									value="#{sessionInv.trialSelected}" 
									styleClass="frmSelectOne"
									rendered="#{!empty sessionInv.trial}"
									onchange="changeTrial()">
									<f:selectItem itemLabel="..." itemValue="#{null}" />
									<f:selectItems value="#{sessionInv.trials}" />
								</h:selectOneMenu>
							</td>
							<td>
						    	<h:commandLink 
						    		id="goGroups"
						    		action="#{groupBean.accListGroupsOfTrial}"
						    		rendered="#{!empty sessionInv.trial}">
						    		<h:graphicImage 
						    			url="/jsp/icons/group_go.png" 
						    			alt="#{msgs['jsf.actions.ListGroups']}" 
						    			title="#{msgs['jsf.actions.ListGroups']}"/>
						    	</h:commandLink>
							</td>
							<td style="vertical-align: top; text-align: right;">
								<b><h:outputText 
										value="#{(!empty sessionInv.group) ? msgs['jsf.generic.Group'] : ''}"/></b>
							</td>
							<td style="vertical-align: top">
								<h:commandLink
						    		id="editGroup"
									action="#{groupBean.accEditGroup}"
									rendered="#{!empty sessionInv.group}">
									<h:outputText 
										value="#{sessionInv.group.description}" />
									<f:setPropertyActionListener 
										target="#{groupBean.group}"
										value="#{sessionInv.group}"/>
								</h:commandLink>
							</td>
							<td>
						    	<h:commandLink 
						    		id="goPatients"
						    		action="#{patientBean.accListPatientsOfGroup}"
						    		rendered="#{!empty sessionInv.group}">
						    		<h:graphicImage 
						    			url="/jsp/icons/user_go.png" 
						    			alt="#{msgs['jsf.actions.ListPatients']}" 
						    			title="#{msgs['jsf.actions.ListPatients']}"/>
						    	</h:commandLink>
							</td>
						</tr>
						<tr>
							<td style="vertical-align: top; text-align: right;">
								<b><h:outputText 
										value="#{(!empty sessionInv.patient) ? msgs['jsf.generic.Patient'] : ''}"/></b>
							</td>
							<td style="vertical-align: top" colspan="4">
								<h:commandLink
						    		id="editPatient"
									action="#{patientBean.accEditPatient}"
									rendered="#{!empty sessionInv.patient}">
									<h:outputText value="#{sessionInv.patient.completeName}"/>
									<f:setPropertyActionListener 
										target="#{patientBean.patient}"
										value="#{sessionInv.patient}"/>
								</h:commandLink>
							</td>
							<td>
						    	<h:commandLink 
						    		id="goStudies"
						    		action="#{studyBean.accListStudiesOfPatient}"
						    		rendered="#{!empty sessionInv.patient}">
						    		<h:graphicImage 
						    			url="/jsp/icons/report_go.png" 
						    			alt="#{msgs['jsf.actions.ListStudies']}" 
						    			title="#{msgs['jsf.actions.ListStudies']}"/>
						    	</h:commandLink>
							</td>
						</tr>
						<tr>
							<td style="vertical-align: top; text-align: right;">
								<b><h:outputText 
										value="#{(!empty sessionInv.study) ? msgs['jsf.generic.Study'] : ''}"/></b>
							</td>
							<td colspan="4" style="vertical-align: top;">
								<h:commandLink
						    		id="editStudy"
									action="#{studyBean.accEditStudy}"
									rendered="#{!empty sessionInv.study}">
									<h:outputText value="#{sessionInv.study.hospitalId}" />
									<f:setPropertyActionListener 
										target="#{studyBean.study}"
										value="#{sessionInv.study}"/>
								</h:commandLink>
							</td>
							<td>
						    	<h:commandLink 
						    		id="goImgsStudy"
						    		action="#{viewStudyImages.accListImagesOfStudy}"
						    		rendered="#{!empty sessionInv.study}">
						    		<h:graphicImage 
						    			url="/jsp/icons/images.png" 
						    			alt="#{msgs['jsf.headers.ImagesOfStudy']}" 
						    			title="#{msgs['jsf.headers.ImagesOfStudy']}"/>
						    	</h:commandLink>
							</td>
						</tr>
						<tr>
							<td style="vertical-align: top; text-align: right;">
								<b><h:outputText 
										value="#{(!empty sessionInv.image) ? msgs['jsf.generic.Image'] : ''}"/></b>
							</td>
							<td style="vertical-align: top;">
								<h:outputText 
									value="#{sessionInv.image.code}"
									rendered="#{!empty sessionInv.image}" />
							</td>
							<td>
						    	<h:commandLink 
						    		id="goTasks"
						    		action="#{tasksBean.accListImgTasks}"
						    		rendered="#{!empty sessionInv.image}">
						    		<h:graphicImage 
						    			url="/jsp/icons/cog_go.png" 
						    			alt="#{msgs['jsf.generic.Tasks']}" 
						    			title="#{msgs['jsf.generic.Tasks']}"/>
						    	</h:commandLink>
							</td>
							<td style="vertical-align: top; text-align: right;">
								<b><h:outputText 
										value="#{(!empty sessionInv.task) ? msgs['jsf.generic.Task'] : ''}"/></b>
							</td>
							<td style="vertical-align: top;">
								<h:outputText 
									value="#{sessionInv.task.code}"
									rendered="#{!empty sessionInv.task}" />
							</td>
							<td>
						    	<h:commandLink 
						    		id="goImgsTasks"
						    		action="#{viewTaskImages.accListImagesOfTask}"
						    		rendered="#{!empty sessionInv.task}">
						    		<h:graphicImage 
						    			url="/jsp/icons/images.png" 
						    			alt="#{msgs['jsf.headers.ImagesOfTask']}" 
						    			title="#{msgs['jsf.headers.ImagesOfTask']}"/>
						    	</h:commandLink>
							</td>
						</tr>
					</table>
				</td>
				<td style="vertical-align: top;">
					<table style="float: right;">
						<tr>
							<td style="vertical-align: top">							
								<h:outputText value="[#{sessionInv.user.login}]"/>
							</td>
							<td>
						    	<h:commandLink 
						    		id="goAdmArea"
						    		action="adminArea"
						    		rendered="#{sessionInv.userAdmin}">
						    		<h:graphicImage 
						    			url="/jsp/icons/key_go.png" 
						    			alt="#{msgs['jsf.area.Admin']}" 
						    			title="#{msgs['jsf.area.Admin']}"/>
						    	</h:commandLink>
							</td>
							<td>
						    	<h:commandLink 
						    		target="_blank"
						    		action="uploadImages">
						    		<h:graphicImage 
						    			url="/jsp/icons/picture_add.png" 
						    			alt="#{msgs['jsf.actions.AddImages']}" 
						    			title="#{msgs['jsf.actions.AddImages']}"/>
						    	</h:commandLink>
							</td>
						</tr>
						<tr>
							<td colspan="3">
								<h:commandButton
									style="visibility: hidden"
									value=""
									id="hiddenButton" 
									action="#{sessionInv.accUpdateTrialSelected}" />
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</h:form>
	</ui:define>
	
	<ui:define name="appMenu">
		<h:form id="frmMenuResearch">
		    <t:jscookMenu id="menu" layout="hbr" theme="ThemeOffice">
	    	    <t:navigationMenuItems id="navitems" value="#{sessionInv.menu}" />
		    </t:jscookMenu>
	    </h:form>					
	</ui:define>
	
</ui:composition>

</html>